var a = getApp();

Page({
    data: {
        list: [],
        page: 1,
        isLoadMore: !0,
        total_page: 0
    },
    onLoad: function(a) {},
    onReady: function() {},
    onShow: function() {
        this.getData();
        var a = wx.getStorageSync("integral");
        a && wx.setNavigationBarTitle({
            title: "".concat(a, "明细")
        });
    },
    getData: function() {
        var t = this, e = a.getNetAddresss("plugin.flyers-advertise.frontend.mini.rewardLog");
        a._postNetWork({
            url: e,
            data: {},
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    list: e.data.data,
                    total_page: e.data.last_page,
                    isLoadMore: !0
                }) : wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1e3
                });
            },
            fail: function(a) {
                console.log(a);
            }
        });
    },
    _getMoreData: function() {
        var t = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var e = a.getNetAddresss("plugin.flyers-advertise.frontend.mini.rewardLog");
            e += "&page=".concat(this.data.page), a._postNetWork({
                url: e,
                success: function(a) {
                    var e = a.data;
                    if (t.data.isLoadMore = !0, 1 === e.result) {
                        var o = e.data.data, n = t.data.list.concat(o);
                        t.setData({
                            list: n
                        });
                    } else t.data.page = t.data.page - 1, t.data.isLoadMore = !1;
                }
            });
        }
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreData() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});